package com.md.api.dao;

import com.md.api.entity.UserInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author liujie
 * @ClassName UserMapper
 * @Date 2022/10/27 15:37
 **/


@Repository
public interface UserMapper {


    int updateBase(UserInfo user);

    UserInfo findByPhone(@Param("phone")String phone);
    UserInfo loginByPhone(@Param("phone")String phone);
    UserInfo findByEmail(@Param("email")String email);
    UserInfo loginByEmail(@Param("email")String email);

    int updateBalance(UserInfo user);
    int updateAccrueExpend(UserInfo user);

    UserInfo getByUserId(@Param("userId")String userId);

    UserInfo getBaseInfoByUserId(@Param("userId")String userId);

    List<UserInfo> list( @Param("nickName")String nickName,
                        @Param("phone")String phone, @Param("email")String email,@Param("userType") String userType, @Param("status")Integer status);

    void updateStatus(@Param("userId")String userId, @Param("status")Integer status);

    List<UserInfo> getUserByStatus(@Param("status")Integer status);

    int register(UserInfo user);

    Double getBalance(@Param("userId")String userId);

    int checkPhone(@Param("userId")String userId, @Param("phone")String phone);

    int changePhone(@Param("userId")String userId, @Param("phone")String phone, @Param("newPhone")String newPhone);
    int setParent(@Param("userId")String userId, @Param("parentUserId")String parentUserId,
                  @Param("parentNickName")String parentNickName,@Param("parentPhone")String parentPhone);

    int setUserType(UserInfo info);

    List<UserInfo> todayBirth(@Param("birthDay")String birthDay);

    void unbindParent(@Param("userId")String userId);

    List<UserInfo> getByParentUserId(@Param("parentUserId")String parentUserId);

    void clearParentUserId(@Param("userId")String userId);
}
